package gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Vector;

import javax.swing.*;
import javax.swing.table.DefaultTableColumnModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableRowSorter;

import sqlstuff.SQLManage;

public class AnimalButtonListener implements ActionListener {
	SQLManage sql;
	public AnimalButtonListener(SQLManage sql) {
		this.sql=sql;
		if(sql == null)
			System.err.println("SQL IS NULL");
		// TODO Auto-generated constructor stub
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		System.out.println("Animal added");
		String breed = JOptionPane.showInputDialog("What is the Animal's breed?");
		String purpose = JOptionPane.showInputDialog("What is the animal's purpose?");
		String medStatus = JOptionPane.showInputDialog("What is the animal's MedStatus?");
		String sex = JOptionPane.showInputDialog("What is the animal's sex?");
		String age = JOptionPane.showInputDialog("What is the animal's age?");
		String[] args= {"@Breed='"+breed+"', @Purpose='"+purpose+"', @MedStatus='"+medStatus+"', @Sex='"+sex+"', @Age='"+age+"'"};
		sql.executeSprocWithParams("Add Animal", args);
		
	}

}
